import Vue from 'vue'
import App from './App.vue'
import router from './router'
import './utils/rem'
// 引入字体样式
import '@/styles/numberFonts/fonts.css'
import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'
import '@/styles/style.less'
Vue.use(ElementUI)
import VueQuillEditor from 'vue-quill-editor'
import 'quill/dist/quill.core.css'
import 'quill/dist/quill.snow.css'
import 'quill/dist/quill.bubble.css'
Vue.use(VueQuillEditor)

import * as echarts from 'echarts'

// 将自动注册所有组件为全局组件
import dataV from '@jiaminghi/data-view'

Vue.use(dataV)
Vue.prototype.$echarts = echarts

// 引入全局类
import common from '@/utils/common.js'
Vue.prototype.$common = common

//引入Day.js
import dayjs from 'dayjs'
//挂载在vue上
Vue.prototype.dayjs = dayjs
import BaiduMap from 'vue-baidu-map'
Vue.use(BaiduMap, {
  ak: 'RnOkG0M0NnKmMWq3jS6nQTn3fQ811YTt'
})

// import mixin from '@/api/CompanyInfoTree.js'
// Vue.mixin(mixin)

import axios from 'axios'
Vue.prototype.$http = axios
//引入video插件
import VideoPlayer from 'vue-video-player'
import 'video.js/dist/video-js.css'
//引入 hls
import 'videojs-contrib-hls'
Vue.use(VideoPlayer)
// Vue.prototype.$serverUrl = "http://1.117.168.204:9989"; // 打包地址（线上）
// Vue.prototype.$serverUrl = 'http://60.163.198.70:9989' // 打包地址（客户服务器）
// Vue.prototype.$serverUrl = "http://192.168.1.65:9989"; // 打包地址（本地）
// Vue.prototype.$serverUrl = 'http://192.168.177.6:9989' // 打包地址
// Vue.prototype.$serverUrl = 'http://122.227.80.90:9989' // 打包地址
Vue.prototype.$serverUrl = 'http://192.168.1.65:8002' // 打包地址

// 正式环境清除所有console.log
if (process.env.NODE_ENV === 'production') {
  if (window) {
    window.console.log = function () {}
  }
}
Vue.config.productionTip = false
Vue.directive('allow', {
  bind: function (el, binding) {
    let permissionList = binding.value //在页面上绑定的 对应权限显示
    let permissionsArr = window.localStorage.getItem('permissionsArr') //获取的用户权限
    permissionsArr = JSON.parse(permissionsArr)
    el.style.display = 'none'
    for (let i = 0; i < permissionsArr.length; i++) {
      if (permissionList === permissionsArr[i]) {
        el.style.display = 'inline-block'
        break
      }
    }
  }
})
//节流
import { reduceExpenditure } from './utils/reduceExpenditure'
Vue.prototype.$reduceExpenditure = reduceExpenditure // 全局注册节流
new Vue({
  router,
  render: h => h(App)
}).$mount('#app')
